package com.sky.mapper;

import com.sky.entity.DishFlavor;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishFlavorMapper {

    /**
     * 批量插入口味数据
     * @param flavorList
     */
    void insertBatch(List<DishFlavor> flavorList);


    /**
     * 根据菜品Id删除对应口味
     * @param dish_id
     */
    @Delete("delete from  dish_flavor where dish_id = #{dish_id}")
    void deleteByDishId(Long dish_id);

    /**
     * 根据菜品Id批量删除对应口味
     * @param dish_ids
     */
    void deleteByDishIds(Long[] dish_ids);


    /**
     * 基于菜品id查口味数据
     * @param dish_id
     * @return
     */
    @Select("select * from dish_flavor where dish_id = #{dish_id}")
    List<DishFlavor> getByDishId(Long dish_id);
}
